{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "filename = \"3.csv\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "outputs": [
    {
     "data": {
      "text/plain": "     Unnamed: 0.1  Unnamed: 0       id  \\\n0               0           0  1335346   \n1               1           1  1335347   \n2               2           2  1335348   \n3               3           3  1335349   \n4               4           4  1335350   \n..            ...         ...      ...   \n195           195         195  1335541   \n196           196         196  1335542   \n197           197         197  1335543   \n198           198         198  1335544   \n199           199         199  1335545   \n\n                                                  text  biaozhu_driver_price  \\\n0    S：喂。\\nD：哎。\\nS：您好。\\nD：喂。\\nS：你好，你说。\\nD：10米，打电话给我...                     0   \n1    S：喂喂。\\nD：哎哎，你好，到那个到那个那你那个水平运费多少钱呐？\\nS：五到车7000。...                  7500   \n2    S：喂，你好。\\nD：哎，你好。\\nS：你好。\\nD：啊，咱那个银川到那个天津西青吨压路机给...                     0   \n3                                        S：您好，请问有什么事吗？                     0   \n4    S：啊。\\nD：喂，你好。\\nS：哎。\\nD：你那个九江到那个合肥的那个紫金是吧？\\nS：啊...                  2000   \n..                                                 ...                   ...   \n195  S：喂，你好。\\nD：喂，你好。\\nS：喂。\\nD：装装多少钱？\\nS：哪个啊？\\nD：装车...                     0   \n196  S：喂，你好。\\nD：啊，你好，那个你们训练庄心妍这个还在不在。\\nS：对呀，给的一百七一吨...                     0   \n197  S：喂，你好。\\nS：喂喂。\\nD：到到德州的拉什么？\\nS：明天装240。\\nD：哦，明天...                     0   \n198           S：喂。\\nD：那个彭州的给多少钱？\\nS：哪里的车啊？\\nD：给多少钱？你说。                     0   \n199  D：哎，你好。\\nS：你说。\\nD：我看您到青岛有货要发走的。\\nS：你多大啊？\\nD：啊，...                  2500   \n\n     biaozhu_shipper_price  old_driver_price  old_shipper_price  \\\n0                      300                 0                  0   \n1                     7000                 0                  0   \n2                     1500                 0                  0   \n3                        0                 0                  0   \n4                     1900                 0                  0   \n..                     ...               ...                ...   \n195                      0                 0                  0   \n196                      0                 0                  0   \n197                    240                 0                  0   \n198                      0                 0                  0   \n199                      0              2500                  0   \n\n     driver_target_price  shipper_target_price  \n0                    300                     0  \n1                   7500                  7000  \n2                      0                  1500  \n3                      0                     0  \n4                   2000                  2000  \n..                   ...                   ...  \n195                    0                     0  \n196                    0                     0  \n197                    0                   240  \n198                    0                     0  \n199                 2500                     0  \n\n[200 rows x 10 columns]",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>Unnamed: 0.1</th>\n      <th>Unnamed: 0</th>\n      <th>id</th>\n      <th>text</th>\n      <th>biaozhu_driver_price</th>\n      <th>biaozhu_shipper_price</th>\n      <th>old_driver_price</th>\n      <th>old_shipper_price</th>\n      <th>driver_target_price</th>\n      <th>shipper_target_price</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>0</td>\n      <td>0</td>\n      <td>1335346</td>\n      <td>S：喂。\\nD：哎。\\nS：您好。\\nD：喂。\\nS：你好，你说。\\nD：10米，打电话给我...</td>\n      <td>0</td>\n      <td>300</td>\n      <td>0</td>\n      <td>0</td>\n      <td>300</td>\n      <td>0</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>1</td>\n      <td>1</td>\n      <td>1335347</td>\n      <td>S：喂喂。\\nD：哎哎，你好，到那个到那个那你那个水平运费多少钱呐？\\nS：五到车7000。...</td>\n      <td>7500</td>\n      <td>7000</td>\n      <td>0</td>\n      <td>0</td>\n      <td>7500</td>\n      <td>7000</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>2</td>\n      <td>2</td>\n      <td>1335348</td>\n      <td>S：喂，你好。\\nD：哎，你好。\\nS：你好。\\nD：啊，咱那个银川到那个天津西青吨压路机给...</td>\n      <td>0</td>\n      <td>1500</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n      <td>1500</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>3</td>\n      <td>3</td>\n      <td>1335349</td>\n      <td>S：您好，请问有什么事吗？</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>4</td>\n      <td>4</td>\n      <td>1335350</td>\n      <td>S：啊。\\nD：喂，你好。\\nS：哎。\\nD：你那个九江到那个合肥的那个紫金是吧？\\nS：啊...</td>\n      <td>2000</td>\n      <td>1900</td>\n      <td>0</td>\n      <td>0</td>\n      <td>2000</td>\n      <td>2000</td>\n    </tr>\n    <tr>\n      <th>...</th>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n    </tr>\n    <tr>\n      <th>195</th>\n      <td>195</td>\n      <td>195</td>\n      <td>1335541</td>\n      <td>S：喂，你好。\\nD：喂，你好。\\nS：喂。\\nD：装装多少钱？\\nS：哪个啊？\\nD：装车...</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n    </tr>\n    <tr>\n      <th>196</th>\n      <td>196</td>\n      <td>196</td>\n      <td>1335542</td>\n      <td>S：喂，你好。\\nD：啊，你好，那个你们训练庄心妍这个还在不在。\\nS：对呀，给的一百七一吨...</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n    </tr>\n    <tr>\n      <th>197</th>\n      <td>197</td>\n      <td>197</td>\n      <td>1335543</td>\n      <td>S：喂，你好。\\nS：喂喂。\\nD：到到德州的拉什么？\\nS：明天装240。\\nD：哦，明天...</td>\n      <td>0</td>\n      <td>240</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n      <td>240</td>\n    </tr>\n    <tr>\n      <th>198</th>\n      <td>198</td>\n      <td>198</td>\n      <td>1335544</td>\n      <td>S：喂。\\nD：那个彭州的给多少钱？\\nS：哪里的车啊？\\nD：给多少钱？你说。</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n    </tr>\n    <tr>\n      <th>199</th>\n      <td>199</td>\n      <td>199</td>\n      <td>1335545</td>\n      <td>D：哎，你好。\\nS：你说。\\nD：我看您到青岛有货要发走的。\\nS：你多大啊？\\nD：啊，...</td>\n      <td>2500</td>\n      <td>0</td>\n      <td>2500</td>\n      <td>0</td>\n      <td>2500</td>\n      <td>0</td>\n    </tr>\n  </tbody>\n</table>\n<p>200 rows × 10 columns</p>\n</div>"
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = pd.read_csv(filename)\n",
    "df"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "outputs": [
    {
     "data": {
      "text/plain": "     Unnamed: 0.1  Unnamed: 0       id  \\\n0               0           0  1335346   \n1               1           1  1335347   \n2               2           2  1335348   \n3               3           3  1335349   \n4               4           4  1335350   \n..            ...         ...      ...   \n195           195         195  1335541   \n196           196         196  1335542   \n197           197         197  1335543   \n198           198         198  1335544   \n199           199         199  1335545   \n\n                                                  text  biaozhu_driver_price  \\\n0    S：喂。\\nD：哎。\\nS：您好。\\nD：喂。\\nS：你好，你说。\\nD：10米，打电话给我...                     0   \n1    S：喂喂。\\nD：哎哎，你好，到那个到那个那你那个水平运费多少钱呐？\\nS：五到车7000。...                  7500   \n2    S：喂，你好。\\nD：哎，你好。\\nS：你好。\\nD：啊，咱那个银川到那个天津西青吨压路机给...                     0   \n3                                        S：您好，请问有什么事吗？                     0   \n4    S：啊。\\nD：喂，你好。\\nS：哎。\\nD：你那个九江到那个合肥的那个紫金是吧？\\nS：啊...                  2000   \n..                                                 ...                   ...   \n195  S：喂，你好。\\nD：喂，你好。\\nS：喂。\\nD：装装多少钱？\\nS：哪个啊？\\nD：装车...                     0   \n196  S：喂，你好。\\nD：啊，你好，那个你们训练庄心妍这个还在不在。\\nS：对呀，给的一百七一吨...                     0   \n197  S：喂，你好。\\nS：喂喂。\\nD：到到德州的拉什么？\\nS：明天装240。\\nD：哦，明天...                     0   \n198           S：喂。\\nD：那个彭州的给多少钱？\\nS：哪里的车啊？\\nD：给多少钱？你说。                     0   \n199  D：哎，你好。\\nS：你说。\\nD：我看您到青岛有货要发走的。\\nS：你多大啊？\\nD：啊，...                  2500   \n\n     biaozhu_shipper_price  old_driver_price  old_shipper_price  \\\n0                      300                 0                  0   \n1                     7000                 0                  0   \n2                     1500                 0                  0   \n3                        0                 0                  0   \n4                     1900                 0                  0   \n..                     ...               ...                ...   \n195                      0                 0                  0   \n196                      0                 0                  0   \n197                    240                 0                  0   \n198                      0                 0                  0   \n199                      0              2500                  0   \n\n     driver_target_price  shipper_target_price  true_shipper_label  \\\n0                    300                     0                   1   \n1                   7500                  7000                   1   \n2                      0                  1500                   1   \n3                      0                     0                  -1   \n4                   2000                  2000                   1   \n..                   ...                   ...                 ...   \n195                    0                     0                  -1   \n196                    0                     0                  -1   \n197                    0                   240                   1   \n198                    0                     0                  -1   \n199                 2500                     0                  -1   \n\n     old_shipper_label  new_shipper_label  true_driver_label  \\\n0                   -1                 -1                 -1   \n1                   -1                  1                  1   \n2                   -1                  1                 -1   \n3                   -1                 -1                 -1   \n4                   -1                  0                  1   \n..                 ...                ...                ...   \n195                 -1                 -1                 -1   \n196                 -1                 -1                 -1   \n197                 -1                  1                 -1   \n198                 -1                 -1                 -1   \n199                 -1                 -1                  1   \n\n     old_driver_label  new_driver_label  \n0                  -1                -1  \n1                  -1                 1  \n2                  -1                -1  \n3                  -1                -1  \n4                  -1                 1  \n..                ...               ...  \n195                -1                -1  \n196                -1                -1  \n197                -1                -1  \n198                -1                -1  \n199                 1                 1  \n\n[200 rows x 16 columns]",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>Unnamed: 0.1</th>\n      <th>Unnamed: 0</th>\n      <th>id</th>\n      <th>text</th>\n      <th>biaozhu_driver_price</th>\n      <th>biaozhu_shipper_price</th>\n      <th>old_driver_price</th>\n      <th>old_shipper_price</th>\n      <th>driver_target_price</th>\n      <th>shipper_target_price</th>\n      <th>true_shipper_label</th>\n      <th>old_shipper_label</th>\n      <th>new_shipper_label</th>\n      <th>true_driver_label</th>\n      <th>old_driver_label</th>\n      <th>new_driver_label</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>0</td>\n      <td>0</td>\n      <td>1335346</td>\n      <td>S：喂。\\nD：哎。\\nS：您好。\\nD：喂。\\nS：你好，你说。\\nD：10米，打电话给我...</td>\n      <td>0</td>\n      <td>300</td>\n      <td>0</td>\n      <td>0</td>\n      <td>300</td>\n      <td>0</td>\n      <td>1</td>\n      <td>-1</td>\n      <td>-1</td>\n      <td>-1</td>\n      <td>-1</td>\n      <td>-1</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>1</td>\n      <td>1</td>\n      <td>1335347</td>\n      <td>S：喂喂。\\nD：哎哎，你好，到那个到那个那你那个水平运费多少钱呐？\\nS：五到车7000。...</td>\n      <td>7500</td>\n      <td>7000</td>\n      <td>0</td>\n      <td>0</td>\n      <td>7500</td>\n      <td>7000</td>\n      <td>1</td>\n      <td>-1</td>\n      <td>1</td>\n      <td>1</td>\n      <td>-1</td>\n      <td>1</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>2</td>\n      <td>2</td>\n      <td>1335348</td>\n      <td>S：喂，你好。\\nD：哎，你好。\\nS：你好。\\nD：啊，咱那个银川到那个天津西青吨压路机给...</td>\n      <td>0</td>\n      <td>1500</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n      <td>1500</td>\n      <td>1</td>\n      <td>-1</td>\n      <td>1</td>\n      <td>-1</td>\n      <td>-1</td>\n      <td>-1</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>3</td>\n      <td>3</td>\n      <td>1335349</td>\n      <td>S：您好，请问有什么事吗？</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n      <td>-1</td>\n      <td>-1</td>\n      <td>-1</td>\n      <td>-1</td>\n      <td>-1</td>\n      <td>-1</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>4</td>\n      <td>4</td>\n      <td>1335350</td>\n      <td>S：啊。\\nD：喂，你好。\\nS：哎。\\nD：你那个九江到那个合肥的那个紫金是吧？\\nS：啊...</td>\n      <td>2000</td>\n      <td>1900</td>\n      <td>0</td>\n      <td>0</td>\n      <td>2000</td>\n      <td>2000</td>\n      <td>1</td>\n      <td>-1</td>\n      <td>0</td>\n      <td>1</td>\n      <td>-1</td>\n      <td>1</td>\n    </tr>\n    <tr>\n      <th>...</th>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n    </tr>\n    <tr>\n      <th>195</th>\n      <td>195</td>\n      <td>195</td>\n      <td>1335541</td>\n      <td>S：喂，你好。\\nD：喂，你好。\\nS：喂。\\nD：装装多少钱？\\nS：哪个啊？\\nD：装车...</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n      <td>-1</td>\n      <td>-1</td>\n      <td>-1</td>\n      <td>-1</td>\n      <td>-1</td>\n      <td>-1</td>\n    </tr>\n    <tr>\n      <th>196</th>\n      <td>196</td>\n      <td>196</td>\n      <td>1335542</td>\n      <td>S：喂，你好。\\nD：啊，你好，那个你们训练庄心妍这个还在不在。\\nS：对呀，给的一百七一吨...</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n      <td>-1</td>\n      <td>-1</td>\n      <td>-1</td>\n      <td>-1</td>\n      <td>-1</td>\n      <td>-1</td>\n    </tr>\n    <tr>\n      <th>197</th>\n      <td>197</td>\n      <td>197</td>\n      <td>1335543</td>\n      <td>S：喂，你好。\\nS：喂喂。\\nD：到到德州的拉什么？\\nS：明天装240。\\nD：哦，明天...</td>\n      <td>0</td>\n      <td>240</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n      <td>240</td>\n      <td>1</td>\n      <td>-1</td>\n      <td>1</td>\n      <td>-1</td>\n      <td>-1</td>\n      <td>-1</td>\n    </tr>\n    <tr>\n      <th>198</th>\n      <td>198</td>\n      <td>198</td>\n      <td>1335544</td>\n      <td>S：喂。\\nD：那个彭州的给多少钱？\\nS：哪里的车啊？\\nD：给多少钱？你说。</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n      <td>-1</td>\n      <td>-1</td>\n      <td>-1</td>\n      <td>-1</td>\n      <td>-1</td>\n      <td>-1</td>\n    </tr>\n    <tr>\n      <th>199</th>\n      <td>199</td>\n      <td>199</td>\n      <td>1335545</td>\n      <td>D：哎，你好。\\nS：你说。\\nD：我看您到青岛有货要发走的。\\nS：你多大啊？\\nD：啊，...</td>\n      <td>2500</td>\n      <td>0</td>\n      <td>2500</td>\n      <td>0</td>\n      <td>2500</td>\n      <td>0</td>\n      <td>-1</td>\n      <td>-1</td>\n      <td>-1</td>\n      <td>1</td>\n      <td>1</td>\n      <td>1</td>\n    </tr>\n  </tbody>\n</table>\n<p>200 rows × 16 columns</p>\n</div>"
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "def cacl_price_result(item):\n",
    "    biaozhu_shipper_price = item['biaozhu_shipper_price']\n",
    "    old_shipper_price = item[\"old_shipper_price\"]\n",
    "    new_shipper_price = item[\"shipper_target_price\"]\n",
    "\n",
    "\n",
    "    biaozhu_driver_price = item['biaozhu_driver_price']\n",
    "    old_driver_price = item['old_driver_price']\n",
    "    new_dirver_price = item['driver_target_price']\n",
    "\n",
    "    true_shipper_label  = -1\n",
    "    old_shipper_label = -1\n",
    "    new_shipper_label = -1\n",
    "\n",
    "    true_driver_label = -1\n",
    "    old_driver_label = -1\n",
    "    new_driver_label = -1\n",
    "\n",
    "    if biaozhu_shipper_price != 0 :\n",
    "        true_shipper_label = 1\n",
    "\n",
    "        if old_shipper_price == 0:\n",
    "            old_shipper_label = -1\n",
    "        else:\n",
    "            if biaozhu_shipper_price == old_shipper_price:\n",
    "                old_shipper_label = 1\n",
    "            else:\n",
    "                old_shipper_label = 0\n",
    "\n",
    "        if new_shipper_price == 0:\n",
    "            new_shipper_label = -1\n",
    "        else:\n",
    "            if new_shipper_price == biaozhu_shipper_price:\n",
    "                new_shipper_label = 1\n",
    "            else:\n",
    "                new_shipper_label = 0\n",
    "\n",
    "\n",
    "    if biaozhu_driver_price != 0 :\n",
    "        true_driver_label = 1\n",
    "\n",
    "        if old_driver_price == 0:\n",
    "            old_driver_label = -1\n",
    "        else:\n",
    "            if biaozhu_driver_price == old_driver_price:\n",
    "                old_driver_label = 1\n",
    "            else:\n",
    "                old_driver_label = 0\n",
    "\n",
    "        if new_dirver_price == 0:\n",
    "            new_driver_label = -1\n",
    "        else:\n",
    "            if biaozhu_driver_price == new_dirver_price:\n",
    "                new_driver_label = 1\n",
    "            else:\n",
    "                new_driver_label = 0\n",
    "\n",
    "\n",
    "\n",
    "    return true_shipper_label  , old_shipper_label , new_shipper_label,true_driver_label , old_driver_label ,new_driver_label\n",
    "\n",
    "df[\"true_shipper_label\"],df[\"old_shipper_label\"],df[\"new_shipper_label\"],df[\"true_driver_label\"] ,df[\"old_driver_label\"] ,df[\"new_driver_label\"] = zip(*df.apply(cacl_price_result,axis=1))\n",
    "df"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "              precision    recall  f1-score   support\n",
      "\n",
      "          -1       0.00      0.00      0.00         0\n",
      "           0       0.00      0.00      0.00         0\n",
      "           1       1.00      0.89      0.94       105\n",
      "\n",
      "    accuracy                           0.89       105\n",
      "   macro avg       0.33      0.30      0.31       105\n",
      "weighted avg       1.00      0.89      0.94       105\n",
      "\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "D:\\Users\\fengfeng.qiu\\anaconda3\\envs\\Validate\\lib\\site-packages\\sklearn\\metrics\\_classification.py:1334: UndefinedMetricWarning: Recall and F-score are ill-defined and being set to 0.0 in labels with no true samples. Use `zero_division` parameter to control this behavior.\n",
      "  _warn_prf(average, modifier, msg_start, len(result))\n",
      "D:\\Users\\fengfeng.qiu\\anaconda3\\envs\\Validate\\lib\\site-packages\\sklearn\\metrics\\_classification.py:1334: UndefinedMetricWarning: Recall and F-score are ill-defined and being set to 0.0 in labels with no true samples. Use `zero_division` parameter to control this behavior.\n",
      "  _warn_prf(average, modifier, msg_start, len(result))\n",
      "D:\\Users\\fengfeng.qiu\\anaconda3\\envs\\Validate\\lib\\site-packages\\sklearn\\metrics\\_classification.py:1334: UndefinedMetricWarning: Recall and F-score are ill-defined and being set to 0.0 in labels with no true samples. Use `zero_division` parameter to control this behavior.\n",
      "  _warn_prf(average, modifier, msg_start, len(result))\n"
     ]
    }
   ],
   "source": [
    "from sklearn.metrics import classification_report\n",
    "df_shippers = df[df['true_shipper_label'] == 1]\n",
    "print(classification_report(df_shippers['true_shipper_label'],df_shippers['new_shipper_label']))\n"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "outputs": [
    {
     "data": {
      "text/plain": "-1    99\n 1    93\n 0     8\nName: new_shipper_label, dtype: int64"
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df[\"new_shipper_label\"].value_counts()"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "outputs": [
    {
     "data": {
      "text/plain": "-1    193\n 1      7\nName: old_shipper_label, dtype: int64"
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df[\"old_shipper_label\"].value_counts()"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "outputs": [
    {
     "data": {
      "text/plain": "-1    161\n 1     39\nName: true_driver_label, dtype: int64"
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df[\"true_driver_label\"].value_counts()"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "outputs": [
    {
     "data": {
      "text/plain": "-1    161\n 1     30\n 0      9\nName: new_driver_label, dtype: int64"
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df[\"new_driver_label\"].value_counts()"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "outputs": [
    {
     "data": {
      "text/plain": "-1    198\n 1      2\nName: old_driver_label, dtype: int64"
     },
     "execution_count": 36,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df[\"old_driver_label\"].value_counts()"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple/\n",
      "Collecting scikit-learn\n",
      "  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/45/d1/9dfb055ce2893c309936d01efab048ac8ee89ec7ac006fa1f65ff67edaad/scikit_learn-1.1.2-cp39-cp39-win_amd64.whl (7.4 MB)\n",
      "     ---------------------------------------- 7.4/7.4 MB 597.0 kB/s eta 0:00:00\n",
      "Collecting scipy>=1.3.2\n",
      "  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/31/ed/88f65e7007146c79d8fc04cc86112c6a449578a01cea3f1d98fbbf8cac71/scipy-1.9.1-cp39-cp39-win_amd64.whl (38.6 MB)\n",
      "     -------------------------------------- 38.6/38.6 MB 551.7 kB/s eta 0:00:00\n",
      "Collecting threadpoolctl>=2.0.0\n",
      "  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/61/cf/6e354304bcb9c6413c4e02a747b600061c21d38ba51e7e544ac7bc66aecc/threadpoolctl-3.1.0-py3-none-any.whl (14 kB)\n",
      "Collecting joblib>=1.0.0\n",
      "  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/3e/d5/0163eb0cfa0b673aa4fe1cd3ea9d8a81ea0f32e50807b0c295871e4aab2e/joblib-1.1.0-py2.py3-none-any.whl (306 kB)\n",
      "Requirement already satisfied: numpy>=1.17.3 in d:\\users\\fengfeng.qiu\\anaconda3\\envs\\validate\\lib\\site-packages (from scikit-learn) (1.23.2)\n",
      "Installing collected packages: threadpoolctl, scipy, joblib, scikit-learn\n",
      "Successfully installed joblib-1.1.0 scikit-learn-1.1.2 scipy-1.9.1 threadpoolctl-3.1.0\n"
     ]
    }
   ],
   "source": [
    "!pip install scikit-learn\n"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "              precision    recall  f1-score   support\n",
      "\n",
      "          -1       0.96      1.00      0.98        95\n",
      "           0       0.00      0.00      0.00         0\n",
      "           1       1.00      0.89      0.94       105\n",
      "\n",
      "    accuracy                           0.94       200\n",
      "   macro avg       0.65      0.63      0.64       200\n",
      "weighted avg       0.98      0.94      0.96       200\n",
      "\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "D:\\Users\\fengfeng.qiu\\anaconda3\\envs\\Validate\\lib\\site-packages\\sklearn\\metrics\\_classification.py:1334: UndefinedMetricWarning: Recall and F-score are ill-defined and being set to 0.0 in labels with no true samples. Use `zero_division` parameter to control this behavior.\n",
      "  _warn_prf(average, modifier, msg_start, len(result))\n",
      "D:\\Users\\fengfeng.qiu\\anaconda3\\envs\\Validate\\lib\\site-packages\\sklearn\\metrics\\_classification.py:1334: UndefinedMetricWarning: Recall and F-score are ill-defined and being set to 0.0 in labels with no true samples. Use `zero_division` parameter to control this behavior.\n",
      "  _warn_prf(average, modifier, msg_start, len(result))\n",
      "D:\\Users\\fengfeng.qiu\\anaconda3\\envs\\Validate\\lib\\site-packages\\sklearn\\metrics\\_classification.py:1334: UndefinedMetricWarning: Recall and F-score are ill-defined and being set to 0.0 in labels with no true samples. Use `zero_division` parameter to control this behavior.\n",
      "  _warn_prf(average, modifier, msg_start, len(result))\n"
     ]
    }
   ],
   "source": [
    "from sklearn.metrics import classification_report\n",
    "\n",
    "print(classification_report(df['true_shipper_label'],df['new_shipper_label']))\n"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "              precision    recall  f1-score   support\n",
      "\n",
      "          -1       0.49      1.00      0.66        95\n",
      "           1       1.00      0.07      0.12       105\n",
      "\n",
      "    accuracy                           0.51       200\n",
      "   macro avg       0.75      0.53      0.39       200\n",
      "weighted avg       0.76      0.51      0.38       200\n",
      "\n"
     ]
    }
   ],
   "source": [
    "print(classification_report(df['true_shipper_label'],df['old_shipper_label']))"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "outputs": [
    {
     "data": {
      "text/plain": "0    156\n1     44\nName: c, dtype: int64"
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['c'].value_counts()"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [
    "def output_result(df):\n",
    "\n",
    "\n",
    "\n"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}